<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-for循环遍历</title>
</head>
<body>
    <script src="/js/vue.js"></script>
    <div id="app">
        <!-- v-for实现页面列表的渲染，语法是item in items，items是源数据数组，item是元素别名。 -->
        <!-- v-for 数组 -->
        <!-- 1. 五下标循环 -->
        <ul>
            <li v-for="item in books">{{item}}</li>
        </ul>

        <!-- 2. 有下标循环 -->
        <ul>
            <li v-for="(item,index) in books">{{index+1}}:{{item}}</li>
        </ul>

        <!-- v-for 对象 -->
        <ul>
            <li v-for="(item,key) in person">{{key}}:{{item}}</li>
        </ul>

        <ul>
            <li v-for="(item,key,index) in person">{{index+1}}:{{key}}:{{item}}</li>
        </ul>

        <!-- 俄罗斯方块：多维度解构怎么玩？v-for 循环嵌套 -->
        <ul v-for="items in persons">
            <li v-for="item in items">{{item}}</li>
        </ul>
    </div>


    <script>
        let app = new Vue({
            el:"#app",
            data:{ 
                msg:'hello world',
                books:['james','kobe','shane','kitty'],//数组
                person:{'name':'shane','age':14,'height':178},//对象
                persons:[[1,2,3,4],['green','red','blue'],['name','shane','kitty']]

            }
        })
    </script> 
</body>
</html>